package first.endtoend

import first.endtoend.Aid
import first.endtoend.PortfolioDetail
import first.endtoend.Product

/*
this service is related to a portfolioDetail
 */

class PortfolioDetailsService
{

    def serviceMethod()
    {

    }

    def productService

    def aidService

    def toJson(PortfolioDetail portfolioDetail)
    {

        Aid aidInstance = portfolioDetail.aid
        Product productInstance = portfolioDetail.product

        println("product-->" + productInstance.toString())
        if (portfolioDetail)
        {

            [
                    id       : portfolioDetail.id,
                    version  : portfolioDetail.version,
                    aid      : aidService.toJson(aidInstance),
                    quantity : portfolioDetail.quantity,
                    reduction: portfolioDetail.reduction,
                    /*  productName:product.lastName,
                      productDescription:product.description,*/
                    product  : productService.toJson(productInstance)

            ]
        }

    }
}
